/**
 *	获取一些配置默认值
 *	开发者：雨中磐石
 *	地址：www.rockoa.com
 *	日期：2023-07-19
 */


package com.framerock.baselib;

import com.framerock.db.DBConn;
import com.framework.Model.ModelOption;

import java.util.Map;

public class Xinhu {

    private static Map<String, String> xinhMap = null;

    public static String getVal(DBConn dbs, String key)
    {
        return getVal(dbs, key, "");
    }
    public static String getVal(DBConn dbs, String key, String dev)
    {
        if(xinhMap==null)xinhMap = Rock.getMap();
        String val = Rock.getMapString(xinhMap, key, dev);
        if(Rock.isEmpt(val)){
            val = ModelOption.get(dbs).getVal(key);
            xinhMap.put(key, val);
        }
        return val;
    }

    public static void initVal()
    {
        xinhMap = null;
    }

    public static void setNull(String key)
    {
        if(xinhMap==null)return;
        String val = Rock.getMapString(xinhMap, key);
        if(!Rock.isEmpt(val))xinhMap.put(key, "");
    }
}
